<?php
	$theme_url = HTTP_CATALOG . 'themes/pavstore/';
	$patterns = array();
	$files = glob(dirname(__FILE__) . '/../image/pattern/*.png');
	
	foreach($files as $file) {
		$patterns[] = basename($file);
	}
?>
<?php echo $header; ?>
<style>
.box-patterns div {
    border: 1px solid #F3F3F3;
    cursor: pointer;
    display: block;
    float: left;
    height: 38px;
    margin: 6px;
    width: 38px;
}
.box-patterns div.active {
    border: 1px solid #FF0000;
}
</style>
<div id="content">
  <div class="breadcrumb">
   <?php echo $this->breadCrumbs(); ?>
  </div>

  <div class="box">
    <div class="heading">
      <h1><img src="view/image/setting.png" alt="" /> PAV Theme Settings</h1>
      <div class="buttons">
	  <a onclick="$('#form').submit();" class="button"><?php echo $_['button_save']; ?></a>
	  <a href="<?php echo UA('design/theme'); ?>" class="button"><?php echo $_['button_cancel']; ?></a></div>
    </div>
    <div class="content">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
		  <table class="form">			
			<tr>
			  <td><?php echo $_['entry_skin']; ?></td>
			  <td>
				<select name="skin">					
					<?php echo form_select_option($_['option_skins'], $config_theme['skin'], true); ?>
				</select>
			  </td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_theme_width']; ?></td>
			  <td><input type="text" name="theme_width" value="<?php echo $config_theme['theme_width']; ?>" /></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_body_pattern']; ?></td>
			  <td>
				<div class="group-input">
					<div class="box-patterns clearfix">	
						<div class="none" style="background:#FFF"></div>
						<?php foreach( $patterns as $pattern )  { ?>
						<div class="<?php echo str_replace(".png","",$pattern);?>" style="background:url(<?php echo $theme_url."image/pattern/".$pattern; ?>)"></div>
						<?php } ?>
					</div>
					<input name="body_pattern" type="hidden" id="userparams_body_pattern" value="<?php echo $config_theme['body_pattern'];?>" />
					<script type="text/javascript">
						$( ".box-patterns div").click( function(){
							$("#userparams_body_pattern").val(  $(this).attr("class") );
							$( ".box-patterns div").removeClass( "active" );
							$(this).addClass( "active" );
						} );
						if( $("#userparams_body_pattern").val() ){ 
							$( ".box-patterns").find("."+ $("#userparams_body_pattern").val() ).addClass( "active" );
						}
					</script>
				</div>
			  </td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_display_mode']; ?></td>
			  <td>
			  <select name="display_mode">
			  <?php echo form_select_option($_['option_display_modes'], $config_theme['display_mode'], true); ?>
			  </select>
			  </td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_home_product_row']; ?></td>
			  <td><input type="text" name="home_product_row" value="<?php echo $config_theme['home_product_row']; ?>" /></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_category_product_row']; ?></td>
			  <td><input type="text" name="category_product_row" value="<?php echo $config_theme['category_product_row']; ?>" /></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_product_product_row']; ?></td>
			  <td><input type="text" name="product_product_row" value="<?php echo $config_theme['product_product_row']; ?>" /></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_manufacturer_product_row']; ?></td>
			  <td><input type="text" name="manufacturer_product_row" value="<?php echo $config_theme['manufacturer_product_row']; ?>" /></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_special_product_row']; ?></td>
			  <td><input type="text" name="special_product_row" value="<?php echo $config_theme['special_product_row']; ?>" /></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_search_product_row']; ?></td>
			  <td><input type="text" name="search_product_row" value="<?php echo $config_theme['search_product_row']; ?>" /></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_contact_us']; ?></td>
			  <td><textarea name="contact" id="contact"><?php echo $config_theme['contact']?></textarea></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_foot_note']; ?></td>
			  <td><textarea name="foot_note" id="foot_note"><?php echo $config_theme['foot_note']?></textarea></td>
			</tr>
			<tr>
			  <td><?php echo $_['entry_paneltool_enabled']; ?></td>
			  <td>
			  <select name="paneltool_enabled">
			  <?php echo form_select_option($_['option_statuses'], $config_theme['paneltool_enabled'], true); ?>
			  </select>
			  </td>
			</tr>			
		  </table>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript" src="view/javascript/ckeditor/ckeditor.js"></script> 
<script type="text/javascript"><!--
CKEDITOR.replace('contact', {
	filebrowserBrowseUrl: '<?php echo UA('common/filemanager'); ?>',
	filebrowserImageBrowseUrl: '<?php echo UA('common/filemanager'); ?>',
	filebrowserFlashBrowseUrl: '<?php echo UA('common/filemanager'); ?>',
	filebrowserUploadUrl: '<?php echo UA('common/filemanager/upload'); ?>',
	filebrowserImageUploadUrl: '<?php echo UA('common/filemanager/upload'); ?>',
	filebrowserFlashUploadUrl: '<?php echo UA('common/filemanager/upload'); ?>'
});

CKEDITOR.replace('foot_note', {
	filebrowserBrowseUrl: '<?php echo UA('common/filemanager'); ?>',
	filebrowserImageBrowseUrl: '<?php echo UA('common/filemanager'); ?>',
	filebrowserFlashBrowseUrl: '<?php echo UA('common/filemanager'); ?>',
	filebrowserUploadUrl: '<?php echo UA('common/filemanager/upload'); ?>',
	filebrowserImageUploadUrl: '<?php echo UA('common/filemanager/upload'); ?>',
	filebrowserFlashUploadUrl: '<?php echo UA('common/filemanager/upload'); ?>'
});
//--></script> 
<?php echo $footer; ?>